Add AI integration framework (Ollama, LM Studio, OpenAI, Anthropic, Universal) - #28
Closed
Xenne93 wants to merge 1 commit into
Closed
Add AI integration framework (Ollama, LM Studio, OpenAI, Anthropic, Universal)#28Xenne93 wants to merge 1 commit into
Xenne93 wants to merge 1 commit into
Conversation
…niversal)
Lays the groundwork for AI-powered features (server monitoring, script/mod
troubleshooting, rule-breaker detection, admin notifications) without
building any of those features yet - this is just the plumbing:
- New AiIntegrationSettings table (one row per SystemProfile): provider,
base URL, encrypted API key, model name, enabled flag. API key is
encrypted at rest via the existing IRconPasswordsCryptoService, same
scheme as PanelSettings' Steam API key
- New IAiService/AiService: sends chat-style requests to whichever
provider is configured. OpenAI, LM Studio, and a generic "Universal"
OpenAI-compatible endpoint all share one implementation (same
request/response shape); Anthropic and Ollama each get their own, since
their APIs differ (Anthropic separates the system prompt out; Ollama
uses its own native /api/chat format instead of OpenAI's)
- New "AI Integration" page, reachable via a link from Panel Settings:
provider dropdown, conditional base URL (required for
Ollama/LM Studio/Universal, optional override for OpenAI/Anthropic),
masked API key with the same configured/remove pattern as the Steam key,
model name, enable toggle, and a Test Connection button
- Test Connection intentionally works regardless of the enable toggle -
it's an explicit, admin-initiated diagnostic action, not an automated
AI feature firing on its own, so requiring the feature to be "on" just
to verify credentials would be backwards
Tested end-to-end against the real OpenAI API with a deliberately invalid
key: confirmed the request reaches api.openai.com, the Bearer auth header
and JSON body are built correctly, and OpenAI's actual error response
("Incorrect API key provided...") surfaces back to the admin. Also
verified settings persist across a reload and the base URL/API key
guidance updates correctly per provider.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lays the groundwork for AI-powered features (server monitoring, script/mod troubleshooting, rule-breaker detection, admin notifications) - this PR is just the plumbing, no actual AI features built on top of it yet.
Backend:
Frontend:
Testing: ran the whole flow end-to-end in Docker, including a real call to the actual OpenAI API with a deliberately invalid key - confirmed the request reaches api.openai.com with the correct auth header and body, and OpenAI's real error response ('Incorrect API key provided...') surfaces back to the admin. Also verified settings persist across a reload and the base URL/API key guidance updates per provider (e.g. Ollama shows http://localhost:11434 as a placeholder and marks the base URL required).